package src.CodeTopSecondPractice;

public class _88 {
    public void merge(int[] nums1, int m, int[] nums2, int n) {
        int tail = m + n - 1;
        int cur1 = m - 1, cur2 = n - 1;
        while (cur2 >= 0) {
            if (cur1 < 0 || nums1[cur1] <= nums2[cur2]) {
                nums1[tail] = nums2[cur2];
                tail--;
                cur2--;
            }else {
                nums1[tail] = nums1[cur1];
                tail--;
                cur1--;
            }
        }
    }
}
